package com.cloud.class04;

public class Person {
//
//    属性、方法、块、构造方法、内部类
//    静态块 -> main() -> 普通块 -> 构造方法。
    private String name;
    static {
        System.out.println("Person的静态代码块");
    }
    {
        System.out.println("Person的构造代码块");
    }
    public Person() {
        System.out.println("Person的无参构造方法");
    }
    public Person(String name) {
        this.name = name;
        System.out.println("Person的有参构造方法");
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    static class Home{
        private String address;
        public Home(String address) {
            this.address = address;
        }
        public String getAddress() {
            return address;
        }

    }

    public static void main(String[] args) {
        Person person = new Person("张三");
        System.out.println(person.getName());

//        Home home = new Person()
//                .new Home("北京");
//        Person person1 = new Person();
//        Person.Home home = person1.new Home("北京");
//        System.out.println(home.getAddress());
        System.out.println("=========================");
        Home home = new Person.Home("北京");
        System.out.println(home.getAddress());


    }
}
